package com.jie.controller;



import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jie.annotation.Limit;
import com.jie.constants.RedisLimitType;
import com.jie.dto.OperationLogDTO;
import com.jie.dto.ThematicCategoryDTO;
import com.jie.entity.ThematicCategory;
import com.jie.entity.UserInfo;
import com.jie.response.RespBean;
import com.jie.service.IThematicCategoryService;
import com.jie.vo.BodyDimensionVO;
import com.jie.vo.ConditionVO;
import com.jie.vo.PageResult;
import com.jie.vo.ThematicCategoryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 专题大类 前端控制器
 * </p>
 *
 * @author jie
 * @since 2024-04-21
 */
@RestController
@RequestMapping("/thematic-category")
@Api(tags = "运动专题标签")
public class ThematicCategoryController {

    @Autowired
    private IThematicCategoryService iThematicCategoryService;


    //查看专题列表
//    @Limit(key = "customer_limit_test", period = 10, count = 3, limitType = RedisLimitType.USER_ID)
    @ApiOperation("查看运动专题标签")
    @GetMapping("/get/thematicCategoryInfo")
    public RespBean<?> thematicCategoryInfo(ConditionVO conditionVO){
        PageResult<ThematicCategoryDTO> pageResult=iThematicCategoryService.getThematicCategoryPageInfo(conditionVO);
        return RespBean.success("查看成功",pageResult);
    }
    @ApiOperation("根据id查看运动专题标签信息")
    @GetMapping("/get/thematicCategoryInfo/{thematicCategoryId}")
    public RespBean<?> getThematicCategoryInfoById(@PathVariable("thematicCategoryId") Integer thematicCategoryId){
        ThematicCategory thematicCategory = iThematicCategoryService.getThematicCategoryPageInfoById(thematicCategoryId);
        return RespBean.success("更新成功",thematicCategory);
    }
    @ApiOperation("添加或更新运动专题标签")
    @PostMapping("/save/thematicCategoryInfo")
    public RespBean<?> saveThematicCategoryInfo(@RequestBody ThematicCategoryVO thematicCategoryVO){
        Boolean flag=iThematicCategoryService.saveThematicCategory(thematicCategoryVO);
        return RespBean.success("更新成功",flag);
    }
    //删除专题
    @ApiOperation("删除运动专题标签")
    @PostMapping("/delete/thematicCategoryInfo/{thematicCategoryId}")
    public RespBean<?> deleteThematicCategoryInfo(@PathVariable("thematicCategoryId") Integer thematicCategoryId){
        Boolean flag=iThematicCategoryService.deleteThematicCategory(thematicCategoryId);
        return RespBean.success("删除成功",flag);
    }
}

